<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>sms 升级部署 </title>
    <link href="//cdn.staticfile.org/layui/2.8.2/css/layui.css" rel="stylesheet">
    <style>
        .log-line {
            font-size: 15px;
            padding: 3px;
        }

        .logDiv {
            width: 100%;
            height: 700px;
            overflow: auto;
        }
    </style>
</head>

<body>
<!-- HTML Content -->
<ul class="layui-nav" lay-filter="demo-filter-nav">
    <li class="layui-nav-item">
        <a href="/upgradeCode">升级代码</a>
    </li>
    <li class="layui-nav-item layui-this">
        <a href="/appConf">配置文件</a>
    </li>
    <li class="layui-nav-item">
        <a href="/script">监控脚本</a>
    </li>
    <li class="layui-nav-item">
        <a href="/nginxConf">nginx配置</a>
    </li>
    <li class="layui-nav-item">
        <a href="/allLog">全部日志</a>
    </li>
    <li class="layui-nav-item">
        <a href="/errorLog">错误日志</a>
    </li>
</ul>

<!--升级模块-->
<div class="layui-bg-gray module" style="padding: 16px;">
    <div class="layui-card">
        <div class="layui-card-header">
            <button type="button" class="layui-btn layui-btn-xs layui-btn-radius" lay-active="c1">
                查看 Java 配置文件
            </button>
            <button type="button" class="layui-btn layui-btn-xs layui-btn-normal layui-btn-radius" lay-active="c2">
                查看 OpenApi 配置文件
            </button>
            <button type="button" class="layui-btn layui-btn-xs layui-btn-warm layui-btn-radius" lay-active="c3">
                查看 Backend 配置文件
            </button>
        </div>
        <div class="layui-card-body">
            <p>配置文件</p>
            <div class="logDiv">
                <pre class="layui-code code-demo" id="confDiv"> </pre>
            </div>
        </div>
    </div>
</div>


<script src="//cdn.staticfile.org/layui/2.8.2/layui.js"></script>
<script>
        layui.use(['jquery'], function () {
            // 引用 jquery
            var $ = layui.$;

            var element = layui.element;
            var layer = layui.layer;

            // 导航点击事件
            element.on('nav(demo-filter-nav)', function (elem) {
                console.log(elem); // 得到当前点击的元素 jQuery 对象
            });

            // 升级代码模块
            var util = layui.util;

            util.event('lay-active', {
                c1: function () {
                    $("#confDiv").html("");
                    $.get(
                        "/cmd/cat?filePath=/opt/gongxiangcity/shared_moped_supervisor_java/application_java.yml"
                        , function (data, status) {
                            let item = $("<div class='log-line'></div>");
                            item.text(data);
                            $("#confDiv").append(item);
                        }
                    );
                },
                c2: function () {
                    $("#confDiv").html("");
                    $.get(
                        "/cmd/cat?filePath=/opt/gongxiangcity/shared_moped_supervisor_openapi/application_openapi.yml"
                        , function (data, status) {
                            let item = $("<div class='log-line'></div>");
                            item.text(data);
                            $("#confDiv").append(item);
                        }
                    );
                },
                c3: function () {
                    $("#confDiv").html("");
                    $.get(
                        "/cmd/cat?filePath=/opt/gongxiangcity/shared_moped_supervisor_backend/application_backend.yml"
                        , function (data, status) {
                            let item = $("<div class='log-line'></div>");
                            item.text(data);
                            $("#confDiv").append(item);
                        }
                    );
                }
            });
        });

</script>
</body>

</html>